home *** CD-ROM | disk | FTP | other *** search
/ Sounds Terrific 1 / Sounds Terrific CD (1994)(Weird Science)(Disc 2 of 2)[!][Amiga-PC].iso / modules / d / detogl2.mod < prev    next >
Encoding:
Text File  |  1994-08-04  |  8.1 KB  |  216 lines

  1. NEW! ReWritten! 2DeTogl Mod v2.0 1by 7Deltigar
  2. Deltigar #1 @8412
  3. Thu Dec 05 11:44:03 1991
  4. ┌────────────────────────────────────────────────────────────────────────────┐
  5. │ Mod Name:       DeTogl Mod v2.0  Mod Author:  Deltigar                     │
  6. │ Difficulty:     Simple           Date:        18 Nov 1991                  │
  7. │ WWIV Version:   4.12, 4.20       Thanks to: Colossil Fossil, The Gatekeeper│
  8. │ Files Affected: utility.c, VARDEC.H, fcns.h, uedit.c(?)                    │
  9. │                                                                            │
  10. │ Description:    This gives you 22 extra toggle bits to do whatever you     │
  11. │   want to with. I also have included two functions to check the music and  │
  12. │   funky_colors bits.  The two main functions are easy. oktogl(int toggle)  │
  13. │   checks the status of the new toggle bits 1 to 22. togl(int toggle) flips │
  14. │   the same bits.  This simplifies a lot of other way to do it when writing │
  15. │   them into the code.                                                      │
  16. └────────────────────────────────────────────────────────────────────────────┘
  17. ┌────────────────────────────────────┐┌──────────────────────────────────────┐
  18. │ Example 1:                         ││ Example 2:                           │
  19. │                                    ││                                      │
  20. │   if (oktogl(5))                   ││  if (!oktogl(5))                     │
  21. │    togl(5);                        ││    togl(5);                          │
  22. │                                    ││                                      │
  23. │ This will always shut it off.      ││ This will always turn it on.         │
  24. │                                    ││                                      │
  25. └────────────────────────────────────┘└──────────────────────────────────────┘
  26.  
  27.      Discussion: There are several mods out there that require the addition
  28.  of systatus bits to the userrec and if taken one at a time, this means
  29.  altering vardec.h every time. There are also many small ideas that any
  30.  sysop can think of that require the same thing, but are then deemed, too
  31.  much for such a little thing. This mod is less of a mod than it is a tool
  32.  for creative sysops. With ALL the systatus bits defined, the creative sysop
  33.  can now do all the little silly things that before seemed to big, and,
  34.  whenever one of those other major mods comes out, there is no need to alter
  35.  vardec.h. A convenience most felt by those of us operating on older
  36.  (slower) machines. Just as an example, how about setting a bit that tracks
  37.  where the user logs of? Then log that user back where they left! With this
  38.  installed, that becomes a minor piece of code!
  39.  
  40.      I will leave the rest up to you...
  41.  
  42.      New in Version 2! Completely rewritten routines. Much smaller, gets the
  43.  job done better. I also added a test routine to help the installation. This
  44.  was written by The gatekeeper and slightly modified by me.
  45.  
  46.  
  47. Here is the mod:
  48.  
  49. In VARDEC.H ****************************************************
  50.  
  51. /* userrec.sysstatus */
  52. #define sysstatus_ansi 0x0001
  53. #define sysstatus_color 0x0002
  54. #define sysstatus_music 0x0004
  55. #define sysstatus_pause_on_page 0x0008
  56. #define sysstatus_expert 0x0010
  57. #define sysstatus_smw 0x0020
  58. #define sysstatus_full_screen 0x0040
  59. #define sysstatus_nscan_file_system 0x0080
  60. #define sysstatus_funky_colors 0x0100
  61. #define sysstatus_clr_scrn 0x0200
  62. #define sysstatus_t_one 0x0400                     /* DeTogl Mod */
  63. #define sysstatus_t_two 0x0800                     /* DeTogl Mod */
  64. #define sysstatus_t_three 0x1000                   /* DeTogl Mod */
  65. #define sysstatus_t_four 0x2000                    /* DeTogl Mod */
  66. #define sysstatus_t_five 0x4000                    /* DeTogl Mod */
  67. #define sysstatus_t_six 0x8000                     /* DeTogl Mod */
  68. #define sysstatus_t_seven 0x00010000               /* DeTogl Mod */
  69. #define sysstatus_t_eight 0x00020000               /* DeTogl Mod */
  70. #define sysstatus_t_nine 0x00040000                /* DeTogl Mod */
  71. #define sysstatus_t_ten 0x00080000                 /* DeTogl Mod */
  72. #define sysstatus_t_eleven 0x00100000              /* DeTogl Mod */
  73. #define sysstatus_t_twelve 0x00200000              /* DeTogl Mod */
  74. #define sysstatus_t_thirteen 0x00400000            /* DeTogl Mod */
  75. #define sysstatus_t_fourteen 0x00800000            /* DeTogl Mod */
  76. #define sysstatus_t_fifteen 0x01000000             /* DeTogl Mod */
  77. #define sysstatus_t_sixteen 0x02000000             /* DeTogl Mod */
  78. #define sysstatus_t_seventeen 0x04000000           /* DeTogl Mod */
  79. #define sysstatus_t_eighteen 0x08000000            /* DeTogl Mod */
  80. #define sysstatus_t_nineteen 0x10000000            /* DeTogl Mod */
  81. #define sysstatus_t_twenty 0x20000000              /* DeTogl Mod */
  82. #define sysstatus_t_twenty_one 0x40000000          /* DeTogl Mod */
  83. #define sysstatus_t_twenty_two 0x80000000          /* DeTogl Mod */
  84.  
  85.  
  86. In UTILITY.C *************************************************
  87.  
  88. Add These:
  89.  
  90.  
  91. int oktogl(int toggle)
  92. {
  93. /* This will return the status of any one of 22 bits. 
  94.    (The Gatekeeper #1 @2461) */
  95.  if (thisuser.sysstatus & ( 1L << (toggle +9) ) )
  96.    return(1);
  97.   else
  98.    return(0);
  99. }
  100.  
  101.  
  102. void togl(int toggle)
  103. {
  104. /* This function flips any one of 22 bits. 
  105.    (The Gatekeeper #1 @2461) */
  106.  unsigned long bit;
  107.  
  108.  bit = 1L << (toggle+9);
  109.  if ( thisuser.sysstatus & bit )
  110.      thisuser.sysstatus ^= bit;
  111.    else
  112.      thisuser.sysstatus |= bit;
  113. }
  114.  
  115.  
  116. int okmusic()
  117. /* This function checks the status of the current user's record to see if
  118.  * the user has specified that he wants ANSI Music.
  119.  */
  120. {
  121.   if (thisuser.sysstatus & sysstatus_music)
  122.     return(1);
  123.   else
  124.     return(0);
  125. }
  126.  
  127. int okfunky()
  128. /* This function checks the status of the current user's record to see if
  129.  * the user has specified that he wants Extended Colors.
  130.  */
  131. {
  132.   if (thisuser.sysstatus & sysstatus_funky_colors)
  133.     return(1);
  134.   else
  135.     return(0);
  136. }
  137.  
  138. DONE? *************************************************************
  139.  
  140. Not yet... Update FCNS.H.
  141.  
  142. int oktogl(int toggle);
  143. void togl(int toggle);
  144. int okmusic();
  145. int okfunky();
  146.  
  147.  
  148. Now, in uedit.c, I use the folowing for the display:
  149.  
  150.  
  151.   if (u->sysstatus & sysstatus_t_fifteen)
  152.     prt(5,"15");
  153.  
  154.  
  155. and in the void uedit, make your case selection here:
  156.  
  157.       prt(2,"Uedit : ");
  158.       if ((realsl==255) || (wfc))
  159.         ch=onek("Q[]{}/,.?UDRNLCPOGMSTEYZAI~$!B:");
  160.       else
  161.         ch=onek("Q[]{}/,.?UDRNLCPOGMSTEYZAI~$:");
  162.       switch(ch) {
  163.  
  164.  
  165. and here is an example case statement:
  166.  
  167.         case '!':
  168.           if (u.sysstatus & sysstatus_t_fifteen){
  169.             u.sysstatus ^= sysstatus_t_fifteen;
  170.             write_user(un,&u);
  171.             break;
  172.           }
  173.  
  174.  
  175.      In Uedit, I only add those bits which I want to be able to alter. There
  176.  are plenty of times when this is not needed, so I don't bother putting them
  177.  here. This will have to be your own choice.     
  178. Now! Your done. Add some stuff that uses some of your new toggles.
  179.  
  180.      
  181. NOTE:
  182. I use funky and music for different things on my board, so I don't have a
  183. set function to toggle them except the funky_colors toggle in the defaults
  184. and a copy of the same that I altered for music.
  185.  
  186. Here is a stretch of code to help test the installation of this mod:
  187.  
  188. in bbs.c void mainmenu:
  189.  
  190.     if (strcmp(s,"TOGL TEST")==0) {
  191.       outchr(12);
  192.       for ( i = 1 ; i < 23 ; i++ ) {
  193.         printf("DeTogl bit %2d is %3s", i, (oktogl(i))?"ON":"OFF" );
  194.         nl();
  195.       }
  196.       pausescr();
  197.       outchr(12);
  198.       for ( i = 0 ; i < 32 ; i++ ) {
  199.         printf("SysStatus bit %2d is %3s", i, (thisuser.sysstatus&(1L<<i))?"ON":"OFF");
  200.         nl();
  201.       }
  202.     }
  203.  
  204.  
  205.  
  206. HONORABLE MENTION:
  207. The Black Dragon #1 @3080      (Gatekeeper's was shorter)
  208. The Emporer #1 @6470           (I couldn't get it to work for me)
  209.  
  210.  
  211.                                        3╘──══╡ 7Deltigar  @8412 3╞══──╛
  212.                                        0     Soon to be:
  213.                                        3╘──══╡ 7Deltigar  @8306 3╞══──╛
  214.  
  215. 7░▒▓█5 WWIVnet Origin:1 Pocket Universe7 Suffolk, VA2 (804)934-8589 3Snarfable 7█▓▒░0
  216.